/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2024-02-21 18:05:34
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2024-06-26 16:16:38
 * @FilePath: \project\node-project\server\routes\users.js
 * @Description: 
 */
var express = require('express');
var router = express.Router();
const UserModel = require('../models/UserModel')

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

router.post('/api/register', async(req, res, next) => {
  let { username, password } = req.body
 
  let result = await UserModel.create({username, password})
  return res.send({
    code: 200,
    msg: '注册成功'
  }) 

});

module.exports = router;
